//******************************************************************************************//
//*************  百度通过经纬度获取详细地址信息 api                                      ***//
//*************  需要 html5支持，需要jQuery       需要修改全局变量,locationRefreshObj    ***//
//*************   locationRefreshType  false--html    true--input                        ***//
//******************************************************************************************//

var APP_PATH = '/';  //定义js中当前应用路径的全局变量
function getLocation()
{
    if(locationRefreshType==null || !locationRefreshType){
        $(locationRefreshObj).html("正在定位中...");
    }else{
        $(locationRefreshObj).val("正在定位中...");
    }

    if (navigator.geolocation)
    {
		
        navigator.geolocation.getCurrentPosition(showPosition,showFail);
    }
    else{
        if(locationRefreshType==null || !locationRefreshType){
            $(locationRefreshObj).val("您的浏览器不支持地理位置定位！！！");
        }else{
            $(locationRefreshObj).val("您的浏览器不支持地理位置定位！！！");
        }
    }
	
}

function showPosition(param)
{
    var lat = param.coords.latitude,lng = param.coords.longitude;
	
    $.getJSON(APP_PATH+'wdh/home/get_address_by_gps/'+lat+'/'+lng,function(json){
    });

}

function showFail(param) {
	
    if(locationRefreshType==null || !locationRefreshType){
        $(locationRefreshObj).val("");
    }else{
        $(locationRefreshObj).val("");
    }

}